<?php


namespace App\Imports;

use App\Models\Staff;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithUpserts;

/**
 * Created By FreeAbrams
 * Date: 2020/12/16
 */
class StaffModel implements ToModel, WithUpserts
{
	public function model(array $row)
	{
		return new Staff([
			'staff_no' => $row[0],
			'name' => $row[1],
			'salary' => $row[2],
			'status' => $row[3]
		]);
	}
	
	public function uniqueBy()
	{
		return 'staff_no';
	}
}